package com.nami.dispatcher.application.user;

import com.nami.dispatcher.facade.user.L1UserCacheDelFacade;
import com.nami.dispatcher.domain.gateway.UserGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class L1UserCacheDelFacadeImpl implements L1UserCacheDelFacade {

    private final UserGateway userRepository;

    @Override
    public void execute(String userId) {
        userRepository.markOnlineUserInvalid(userId);
        log.info("[user-cache] 用户下线，删除缓存信息，等待下次获取！ userId={}", userId);
    }

}
